//
//  BNDChooseCompanyCell.m
//  OfficeDoc
//
//  Created by pie on 2022/4/1.
//  Copyright © 2022 pie. All rights reserved.
//

#import "BNDChooseCompanyCell.h"

@interface BNDChooseCompanyCell ()
@property (strong, nonatomic) UILabel *nameLabel;
@property (strong, nonatomic) UIImageView *selectedImageView;
@end

@implementation BNDChooseCompanyCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {

        _nameLabel = [[UILabel alloc] init];
        _nameLabel.text =@"1111";
        _nameLabel.textColor = UIColorWithHex(0x34363B);
        _nameLabel.font = BNDPFMediumFont(18);
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.contentView.mas_left).offset(32);
            make.right.mas_equalTo(self.contentView.mas_right).offset(-100);
            make.centerY.mas_equalTo(self.contentView);
        }];
        
        
        _selectedImageView = [[UIImageView alloc] initWithImage:BNDImageNamed(@"bnd_selected_company")];
        _selectedImageView.hidden = YES;
        [self.contentView addSubview:_selectedImageView];
        [_selectedImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(16, 13));
            make.right.mas_equalTo(self.contentView.mas_right).offset(-32);
            make.centerY.mas_equalTo(self.contentView);
        }];
    }
    
    return self;
}

- (void)setModel:(BNDChooseCompanyModel *)model
{
    _model = model;
    _nameLabel.text = model.companyName;
    _nameLabel.textColor = model.isSelected ? UIColorWithHex(0x3770EB):UIColorWithHex(0x34363B);
    _selectedImageView.hidden = !model.isSelected;
}
@end
